<template>

  <el-container style="overflow: hidden; height: 100%; width: 100%; ">

    <el-header height="auto" style=" border-bottom: 1px solid rgba(6, 15, 26, 0.07); ">
      <api-header ref="apiHeader"></api-header>
    </el-header>

    <el-container class="api-body-contaniner">

      <el-form ref="formEl"  :model="formValue" label-width="0px;" style=" width: 380px;  margin:100px auto 0; ">

        <el-row>
          <el-col style="width: 100%; text-align: center; line-height: 60px;">
              开放平台登陆
          </el-col>
        </el-row>

        <el-row>
          <el-col style="width: 100%;">

            <el-form-item >
              <el-input
                placeholder="请输入用户名"
                prefix-icon="el-icon-s-custom"
                v-model="formValue.loginId"
                size="medium"
              >
              </el-input>
            </el-form-item>

          </el-col>
        </el-row>

        <el-row>
          <el-col style="width: 100%;">
            <el-form-item >
              <el-input
                placeholder="请输入密码"
                prefix-icon="el-icon-lock"
                v-model="formValue.password"
                size="medium"
                show-password
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>

<!--        <el-row>-->
<!--          <el-col style="width: 100%;">-->
<!--            <el-form-item >-->
<!--              <el-input-->
<!--                placeholder="请输入内容"-->
<!--                prefix-icon="el-icon-lock"-->
<!--                v-model="formValue.password"-->
<!--                size="medium"-->
<!--              >-->
<!--              </el-input>-->
<!--              -->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->

        <el-row>
          <el-col style="width: 100%;">
            <el-form-item label="">
              <el-button size="medium" style="width:100%;" type="primary" @click="submitForm">登   陆</el-button>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>


    </el-container>

  </el-container>

</template>


<script>

  import Vue from 'vue'

  import ApiHeader from '../layout/api-header.vue'

  export default {

    components: {  ApiHeader },

    data() {
      return {
        formValue:{}
      };
    },

    watch: {
    },

    created() {
    },

    mounted() {
      var _this = this;
    },

    destroyed() {
    },

    methods: {

      loadAllApps() {
      },

      submitForm(){

        let _this = this

        _this.$ajax({
          url: '/open-api/open/OpenPlatformRpc/login.json',
          data:{
            'loginId': _this.formValue.loginId,
            'pwd': _this.$md5(_this.formValue.password)
          },
          success: function (res) {

            _this.$message({
              type:'success',
              message: '登陆成功'
            })

            if(res && res.data){
              Vue.prototype.$loginUser = {...res.data}
            }

            _this.$jump('/api_doc/readme')
          }
        })

      }

    }
  }

</script>
<style>


</style>
